<template>
	<div class="home">
		<cmd-nav-bar iconOne="menu" back :left-text="titlehead" iconTwo="add" @iconTwo="toadd"></cmd-nav-bar>
		<div class="not_thing"></div>
		<mt-navbar v-model="selected">
			<mt-tab-item id="1">{{city}}
				<div class="img_box" @click="toChooseList(1)">
					<img src="../../myimg/tobottom.png" alt="">
				</div>
			</mt-tab-item>
			<mt-tab-item id="2">{{variet}}
				<div class="img_box center" @click="toChooseList(2)">
					<img src="../../myimg/tobottom.png" alt="">
				</div>
			</mt-tab-item>
			<mt-tab-item id="3">{{seekstatu}}
				<div class="img_box right" @click="toChooseList(3)">
					<img src="../../myimg/tobottom.png" alt="">
				</div>
			</mt-tab-item>
		</mt-navbar>
		<list :arrayingo="bigaray"></list>

	</div>
</template>
<script>
	import list from '@/pages/mypage/le_assembly/loss_list.vue'
	import loss1 from '@/pages/myimg/loss1.jpg'
	import loss2 from '@/pages/myimg/loss2.jpg'
	import loss3 from '@/pages/myimg/loss3.jpg'
	import loss4 from '@/pages/myimg/loss4.jpg'
	import loss5 from '@/pages/myimg/loss5.jpg'
	import loss6 from '@/pages/myimg/loss6.jpg'
	import love1 from '@/pages/myimg/love1.jpg'
	import love2 from '@/pages/myimg/love2.jpg'
	import love3 from '@/pages/myimg/love3.jpg'
	import adopt1 from '@/pages/myimg/adopt1.jpg'
	import adopt2 from '@/pages/myimg/adopt2.jpg'
	import adopt3 from '@/pages/myimg/adopt3.jpg'
	import cmdNavBar from "@/components/cmd-nav-bar/cmd-nav-bar.vue"
	import {
		Navbar,
		TabItem
	} from 'mint-ui';
	export default {
		props: {},
		components: {
			cmdNavBar,
			Navbar,
			TabItem,
			list

		},
		data() {
			return {
				titlehead: '',
				tabList5: [{
						name: "短信",
						icon: "icon-comment"
					},
					{
						name: "电话",
						icon: "icon-dianhua"
					},
					{
						name: "wifi",
						icon: "icon-wifi"
					}
				],
				TabCur5: 0,
				selected: "1",
				city: '绵阳市',
				variet: '品种',
				seekstatu: '全部',
				state: '状态',
				bigaray: [],
				love: [{
					"name": '潇洒哥',
					"gender": 1,
					"doghead": love1,
					"age": '1年3个月',
					"status": 1,
					"dsc": '待领养',
					"addressinfo": '四川省绵阳市经开区'
				}, {
					"name": '胖头妹',
					"gender": 1,
					"doghead": loss2,
					"age": '1年3个月',
					"status": 1,
					"dsc": '怎么会爱上了它',
					"addressinfo": '四川省绵阳市经开区'
				}, {
					"name": '不菲尔',
					"gender": 1,
					"doghead": loss3,
					"age": '1年3个月',
					"status": 1,
					"dsc": '并决定带它回家',
					"addressinfo": '四川省绵阳市经开区'
				}],
				adoptarr: [{
					"name": '潇洒哥',
					"gender": 1,
					"doghead": adopt1,
					"age": '1年3个月',
					"status": 1,
					"dsc": '找帅狗一只',
					"addressinfo": '四川省绵阳市经开区'
				}, {
					"name": '胖头妹',
					"gender": 1,
					"doghead": adopt2,
					"age": '1年3个月',
					"status": 1,
					"dsc": '怎么会爱上了它',
					"addressinfo": '四川省绵阳市经开区'
				}, {
					"name": '不菲尔',
					"gender": 1,
					"doghead": adopt3,
					"age": '1年3个月',
					"status": 1,
					"dsc": '并决定跟它回家',
					"addressinfo": '四川省绵阳市经开区'
				}],
				info: [{
						"name": '潇洒哥',
						"gender": 1,
						"doghead": loss1,
						"age": '1年3个月',
						"status": 1,
						"dsc": '在人民公园丢了的',
						"addressinfo": '四川省绵阳市经开区'
					},
					{
						"name": '胖头妹',
						"gender": 2,
						"doghead": loss2,
						"age": '2年4个月',
						"status": 1,
						"dsc": '有些狗走着走着就没了',
						"addressinfo": '四川省绵阳市游仙区'
					},
					{
						"name": '牛飞儿',
						"gender": 2,
						"doghead": loss3,
						"age": '3年2个月',
						"status": 1,
						"dsc": '你为何要离开我',
						"addressinfo": '四川省绵阳市科创区'
					},
					{
						"name": '马丁弟弟',
						"gender": 1,
						"doghead": loss4,
						"age": '3年1个月',
						"status": 1,
						"dsc": '你是我的小蝴蝶',
						"addressinfo": '四川省绵阳市科创区'
					},
					{
						"name": '鱼仔妹妹',
						"gender": 1,
						"doghead": loss5,
						"age": '1年10个月',
						"status": 1,
						"dsc": '你怎么舍得我难过',
						"addressinfo": '四川省绵阳市科创区'
					},
					{
						"name": '卑微小年',
						"gender": 2,
						"doghead": loss6,
						"age": '2年8个月',
						"status": 1,
						"dsc": '没得排面的小年',
						"addressinfo": '四川省绵阳市高新区'
					}
				]
			}
		},
		methods: {
			toChooseList(n) {
				switch (n) {
					case 1:
						uni.navigateTo({
							url: 'chooseList',
						});
						break;
					case 2:
						uni.navigateTo({
							url: 'typedog',
						});
						break;
					case 3:
						uni.navigateTo({
							url: 'varieties?val=' + localStorage.getItem('type'),
						});
						break;
				}

			},
			toadd() {
				if (localStorage.getItem('type') == "1") {
					uni.navigateTo({
						url: 'add_loss'
					});
				}

			},
		},
		watch: {},

		onReachBottom() { //页面上拉触底事件的处理函数

		},
		onPullDownRefresh() { //监听用户下拉动作，一般用于下拉刷新
			//需要在 pages.json 里，找到的当前页面的pages节点，并在 style 选项中开启 enablePullDownRefresh
			//uni.startPullDownRefresh(); 开启
			// uni.stopPullDownRefresh(); 关闭
		},
		onUnload() { //监听页面卸载

		},
		onHide() { //监听页面隐藏

		},
		onLoad() { // 替代 created 监听页面加载，其参数为上个页面传递的数据，参数类型为Object（用于页面传参），参考示例

		},
		onReady() { //替代 mounted 监听页面初次渲染完成
			if (localStorage.getItem('city')) {
				this.city = localStorage.getItem('city')
			}
			if (localStorage.getItem('vatiet')) {
				this.variet = localStorage.getItem('vatiet')
			}
			if (localStorage.getItem('seekstatu')) {
				this.seekstatu = localStorage.getItem('seekstatu')
			}
            
			if (location.href.split("=")[1]) {
				var type = location.href.split("=")[1];
				localStorage.setItem('type', type)
				this.seekstatu = '全部'
			}
			var stor = localStorage.getItem('type')
			switch (stor) {
				case "1":
					this.titlehead = "宠物挂失"
					this.bigaray = this.info
					break;
				case "2":
					this.titlehead = "宠物姻缘"
					this.bigaray = this.love
					break;
				case "3":
					this.titlehead = "宠物领养"
					this.bigaray = this.adoptarr
					break;
				default:
					this.titlehead = "宠物挂失"
					// this.seekstatu = '全部'

			}
		},

		onShow() { //监听页面显示
			//生命周期
		}
	}
</script>
<style scoped>
	.home {
		width: 100%;
		height: 100%;
	}

	.not_thing {
		width: 100%;
		height: 14vw;
		background: #f8f8f8;
	}

	.mint-navbar .mint-tab-item.is-selected {
		border-bottom: 1px solid #26a2ff;
	}

	img {
		height: 100%;
		width: 100%;
	}

	.img_box {
		height: 4vw;
		width: 4vw;
		position: absolute;
		top: 18vw;
		left: 23vw;
	}

	.center {
		left: 58vw;
	}

	.right {
		left: 88vw;
	}
</style>
